import * as actionTypes from './constants';
import { getSongDetail } from '@/service/player';


const changeCurrentSongAction = (currentSong) => ({
    type: actionTypes.CHANGE_CURRENT_SONG,
    currentSong
})


/**
 * 歌曲详情
 * @returns 
 */
export const getSongDetailAction = (ids) => {
    return dispatch => {
        getSongDetail(ids).then(res => {
            dispatch(changeCurrentSongAction(res.songs[0]));
        });
    }
}